import uvm_pkg::*;
`include "uvm_macros.svh"

class mpi_xaction extends uvm_sequence_item;
	bit[31:0] data;
	bit[15:0] addr;
	bit		  op_type;
	rand int  Tcas;
	rand int  Tcah;
	rand int  Tcrw;
	rand int  Tcrh;
	rand int  Tcrr;
	rand int  Tcwh;

	constraint mpi_timing_cons;
	
	`uvm_object_utils_begin(mpi_xaction)
		`uvm_field_int(data,UVM_ALL_ON | UVM_NOPACK)
		`uvm_field_int(addr,UVM_ALL_ON | UVM_NOPACK)
		`uvm_field_int(op_type,UVM_ALL_ON | UVM_NOPACK)
		`uvm_field_int(Tcas,UVM_ALL_ON | UVM_NOPACK | UVM_NOCOMPARE)
		`uvm_field_int(Tcah,UVM_ALL_ON | UVM_NOPACK | UVM_NOCOMPARE)
		`uvm_field_int(Tcrw,UVM_ALL_ON | UVM_NOPACK | UVM_NOCOMPARE)
		`uvm_field_int(Tcrh,UVM_ALL_ON | UVM_NOPACK | UVM_NOCOMPARE)
		`uvm_field_int(Tcrr,UVM_ALL_ON | UVM_NOPACK | UVM_NOCOMPARE)
		`uvm_field_int(Tcwh,UVM_ALL_ON | UVM_NOPACK | UVM_NOCOMPARE)
	`uvm_object_utils_end
	
	extern function new(string name = "mpi_xaction");
	extern function void pre_randomize();
	extern function void post_randomize();
	
endclass: mpi_xaction

constraint mpi_xaction::mpi_timing_cons{
	Tcas >= 1 ; 
	Tcas <	10;
	Tcah >= 1 ;
	Tcah <  10;
	Tcrw >= 1 ;
	Tcrw <  10;
	Tcwh >= 20;
	Tcwh <  20;
	Tcrr >= 1 ;
	Tcrr <  10;
}

function mpi_xaction::new(string name = "mpi_xaction");
	super.new(name);
endfunction: new

function void mpi_xaction::pre_randomize();
endfunction: pre_randomize

function void mpi_xaction::post_randomize();
endfunction: post_randomize
